package view;

import java.awt.Color;
import java.util.ArrayList;

import javax.swing.ImageIcon;

import model.ClassicMap;
import model.HumanPlayer;
import model.Map;
import model.Player;
import model.AI.SimpleCyborg;

public class TestGUI {
	
	public static void main(String[] args) throws InterruptedException{
		ArrayList<Player> playerList = new ArrayList<Player>();
		
		
		/**
		 * Kevin - Using a lock Object so whatever creates the GameStartConfig
		 * window will know when it can access the two ints. If you have another way to do
		 * this on the server side go ahead and do it that way. This was just for my tests.
		 */
		
		Object lock = new Object();
		
		GameStartConfig gsc = new GameStartConfig(lock);
		gsc.setVisible(true);
		
		synchronized(lock){
			System.out.println("test waiting on GameStartConfig");
			lock.wait();
		}
		
		System.out.println("test recieved notify from lock");
		
		int h = gsc.getGameConfig().getTotalHumans();
		int t = gsc.getGameConfig().getTotalPlayers();
		
		System.out.println("Human: "+h);
		System.out.println("Total: "+t);
		
		for(int i  = 0; i < h; i++){
			Player temp = new HumanPlayer("Name "+i, Color.ORANGE, new ImageIcon("images/players/ChuckNorris.png"));
			if( i == 1)
				temp.setColor(Color.GRAY);
			if( i == 2)
				temp.setColor(Color.GREEN);
			if( i == 3)
				temp.setColor(Color.PINK);
			if( i == 4)
				temp.setColor(Color.RED);
			if( i == 5)
				temp.setColor(Color.YELLOW);
			playerList.add(temp);
		}
		for(int i = h; i < t; i++){
			Player temp = new SimpleCyborg("AI "+i, Color.ORANGE, new ImageIcon("images/players/Wall-E.png"));
			if( i == 1)
				temp.setColor(Color.GRAY);
			if( i == 2)
				temp.setColor(Color.GREEN);
			if( i == 3)
				temp.setColor(Color.PINK);
			if( i == 4)
				temp.setColor(Color.RED);
			if( i == 5)
				temp.setColor(Color.YELLOW);
			playerList.add(temp);
		}
		
		Map gameMap = new ClassicMap(playerList);
		if(gsc.getGameConfig().isRandomAssign()){
			gameMap.assignRulers();
		}
		new SplashRiskFrame(gameMap, null);
	}
}
